import { GSprite } from "../../../../../com/mui/controls/GSprite";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GBitmap } from "../../../../../com/mui/controls/GBitmap";
//class NormalBgItem
    
    export  class NormalBgItem extends GSprite
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            this._itemBg = ResouceConst.getScaleBitmap("PackItemBg");
            this._itemBg.x = -3;
            this._itemBg.y = -3;
            this.addChild(this._itemBg);
            this._icon = ObjCreate.createGBitmap(null, 0, 0, this);
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            if (this._itemBg) 
            {
                this._itemBg.dispose();
                this._itemBg = null;
            }
            if (this._icon) 
            {
                this._icon.dispose();
                this._icon = null;
            }
            return;
        }

        public setBitmapData(arg1): void
        {
            if (typeof arg1 === "string") 
            {
                this._icon.bitmapData = GlobalClass.getBitmapData(arg1);
            }
            else if (arg1 is flash.display.BitmapData) 
            {
                this._icon.bitmapData = arg1;
            }
            this._itemBg.width = this._icon.width + 6;
            this._itemBg.height = this._icon.height + 6;
            return;
        }

        /* internal */ /* var */_itemBg: ScaleBitmap;

        /* internal */ /* var */_icon: GBitmap;
    }
